<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
	 <!-- Required meta tags -->
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
  <title>Purple Admin</title>
  <!-- plugins:css -->
  <link rel="stylesheet" href="../../vendors/iconfonts/mdi/css/materialdesignicons.min.css"/>
  <link rel="stylesheet" href="../../vendors/css/vendor.bundle.base.css"/>
  <!-- endinject -->
  <!-- plugin css for this page -->
  <link rel="stylesheet" href="../../node_modules/jqvmap/dist/jqvmap.min.css" />
  <!-- End plugin css for this page -->
  <!-- inject:css -->
  <link rel="stylesheet" href="../../css/style.css"/>
  <!-- endinject -->
  <link rel="shortcut icon" href="../../images/favicon.png" />


</head>
<body>
	<div class="col-lg-12 stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">
				  <button type="button" class="btn btn-gradient-primary btn-rounded btn-icon">
                          <i class="mdi mdi-home-outline"></i>
                        </button>
					<!-- <i class="mdi mdi-home-variant"></i>	 -->
				  <font style="vertical-align: inherit;"><font style="vertical-align: inherit;">首页/财务管理/银行账户管理/现金流水录入</font></font></h4>
                  <span class="card-description"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                    数据列表 </font></font>
                  </span>
				  <div style="position:relative;left:84%;">
				  <button type="button" class="btn btn-gradient-success"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;" th:onclick="'add()'">录入</font></font></button>
				  <button type="button" class="btn btn-gradient-light"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;" onclick="method5('tableExcel')">
                      导出</font></font></button>
                  </div>
				  <table class="table table-bordered"  id="tableExcel"  width="100%" border="1" cellspacing="0" cellpadding="0">
                    <thead>
                      <tr>
                        <th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          流水编号
                        </font></font></th>
                        <th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          交易日期
                        </font></font></th>
                        <th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          摘要
                        </font></font></th>
                        <th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          收入
                        </font></font></th>
						<th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          录入时间
                        </font></font></th>
						<th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          发生账户备注
                        </font></font></th>
						<th><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
                          操作
                        </font></font></th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr th:each="app:${appliushuiList}">
                        <td th:text="${app.alSerialNum}"></td>
                        <td th:text="${app.alTime}"></td>
                        <td th:text="${app.alPurpose}"></td>
                        <td th:text="${app.alLoanMoney}"></td>
                        <td th:text="${app.alTime}"></td>
						<td th:text="${app.alComment}"></td>
						<td><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">
						  <a href="javascript:;" th:onclick="'del(this)'" th:attr="alId=${app.alId }">删除</a>
                        </font></font></td>
                      </tr>
                    </tbody>
                  </table>
                </div>
                  <div style="display: none;" id="editDiv">
                      <form th:action="@{/ysy/addapp}" method="post">
                          <table>
                              <input type="hidden" name="userId" id="edit_userId" value="0"/>
                              <tr>
                                  <td>流水编号：</td>
                                  <td><input type="text" name="userName" id="edit_userName"/></td>
                              </tr>
                              <tr>
                                  <td>交易日期：</td>
                                  <td><input type="date" name="phone" id="edit_phone"/></td>
                              </tr>
                              <tr>
                                  <td>摘要：</td>
                                  <td><input type="text" name="address" id="edit_address"/></td>
                              </tr>
                              <tr>
                                  <td>e收入：</td>
                                  <td><input type="text" name="shouru" id="edit_shouru"/></td>
                              </tr>
                              <tr>e
                                  <td>备注：</td>
                                  <td><input type="text" name="beizhu" id="edit_beizhu"/></td>
                              </tr>
                              <tr>
                                  <td colspan="2">
                                      <button>确定</button>
                                  </td>
                              </tr>
                          </table>
                      </form>
                  </div>
              </div>
            </div>
    <script type="text/javascript" th:src="@{/js/jquery-1.8.3.min.js}"></script>
    <script type="text/javascript" th:src="@{/layer/layer.js}"></script>
    <script type="text/javascript" th:src="@{/js/time.js}"></script>
    <script type="text/javascript">
        var idTmr;
        function  getExplorer() {
            var explorer = window.navigator.userAgent ;
            //ie
            if (explorer.indexOf("MSIE") >= 0) {
                return 'ie';
            }
            //firefox
            else if (explorer.indexOf("Firefox") >= 0) {
                return 'Firefox';
            }
            //Chrome
            else if(explorer.indexOf("Chrome") >= 0){
                return 'Chrome';
            }
            //Opera
            else if(explorer.indexOf("Opera") >= 0){
                return 'Opera';
            }
            //Safari
            else if(explorer.indexOf("Safari") >= 0){
                return 'Safari';
            }
        }
        function method5(tableid) {
            if(getExplorer()=='ie')
            {
                var curTbl = document.getElementById(tableid);
                var oXL = new ActiveXObject("Excel.Application");
                var oWB = oXL.Workbooks.Add();
                var xlsheet = oWB.Worksheets(1);
                var sel = document.body.createTextRange();
                sel.moveToElementText(curTbl);
                sel.select();
                sel.execCommand("Copy");
                xlsheet.Paste();
                oXL.Visible = true;

                try {
                    var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
                } catch (e) {
                    print("Nested catch caught " + e);
                } finally {
                    oWB.SaveAs(fname);
                    oWB.Close(savechanges = false);
                    oXL.Quit();
                    oXL = null;
                    idTmr = window.setInterval("Cleanup();", 1);
                }

            }
            else
            {
                tableToExcel(tableid)
            }
        }
        function Cleanup() {
            window.clearInterval(idTmr);
            CollectGarbage();
        }
        var tableToExcel = (function() {
            var uri = 'data:application/vnd.ms-excel;base64,',
                template = '<html><head><meta charset="UTF-8"/></head><body><table>{table}</table></body></html>',
                base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },
                format = function(s, c) {
                    return s.replace(/{(\w+)}/g,
                        function(m, p) { return c[p]; }) }
            return function(table, name) {
                if (!table.nodeType) table = document.getElementById(table)
                var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
                window.location.href = uri + base64(format(template, ctx))
            }
        })();




        //删除用户
        function del(ele) {
            var $ele = $(ele);
            var alId = $ele.attr('alId');
            // alert(alId);
            $.ajax({
                url: '/ysy/delapp/' + alId + "",
                type: 'get',
                data: '',
                dataType: 'json',
                success: function (data) {//{'success':xx,'msg':'xxxx'}
                    if (data.success) {
                        alert("成功");
                        //页面删除行
                        $("#Conframe").load("/ysy/account2?currentPageNo=1");
                    } else {
                        alert("失败");

                    }
                }
            });
        }
        //新增用户
        function add() {
            layer.open({
                'title': '录入',
                'type': 1,
                'content': $("#editDiv")
            });
        }
    </script>

</body>
</html>